package com.xzl.org.learning_situation_analysis.controller;

import com.xzl.org.learning_situation_analysis.dao.PaperMapper;
import com.xzl.org.learning_situation_analysis.entity.Paper;
import com.xzl.org.learning_situation_analysis.entity.Question;
import com.xzl.org.learning_situation_analysis.entity.acceptBean.AcceptPaper;
import com.xzl.org.learning_situation_analysis.service.PaperService;
import com.xzl.org.learning_situation_analysis.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author 夏智力
 * @FileName PaperController
 * @date 2022/4/14 13:54
 * @Software: IntelliJ IDEA
 */
@RestController
public class PaperController {

    @Autowired
    private PaperService paperService;

    @Autowired
    private QuestionService questionService;

    public String PaperResolve(@RequestBody AcceptPaper acceptPaper) {

        Paper paper = acceptPaper.getPaper();
        paperService.insertPaper(paper);
        List<Question> questionList = new ArrayList<>();

        // 试卷拆解
        Question question = null;
        for (int i = 0; i < questionList.size(); i++) {
            question = questionList.get(i);
            questionService.insertQuestion(question);
        }

        return null;
    }

}
